old_protocol = "8" # Backward compat. with old numbering scheme.
old_script = "8001"
</header>
<description>
≤GB≥Custom TCP Probe≤P≥
This probe lets you send your own string over the TCP connection and set the status of the device depending on the response received. There are six parameters which control the operation of this probe:
≤i≥String to send≤p≥ is the initial string sent over the TCP connection. This could be a command which indicates what to test, or a combination of a command and a password. The string is sent on its own line, terminated by a CR-LF.
≤i≥Seconds to wait≤p≥ is the number of seconds to wait for a response. If no response is received within the specified number of seconds, the device's status is set to DOWN.
≤i≥OK Response≤p≥ is the substring which should match the device's "ok response". If it matches the first line received, the device is reported to have a status of OK.
≤i≥WARN Response≤p≥ is the substring which should match the device's warning response.
≤i≥ALRM Response≤p≥ is the substring which should match the device's alarm response.
≤i≥DOWN Response≤p≥ is the substring which should match the device's down response.
If InterMapper cannot connect to the specified TCP port, the device's status is set to DOWN.
</description>
<parameters>
"String to send" = ""
"Seconds to wait" = "30"
"OK Response" = ""
"WARN Response" = ""
"ALRM Response" = ""
"DOWN Response" = ""
</parameters>
<script>
CONN #60 (connect timeout in secs)
SEND "${String to send}\r\n"
WAIT #${Seconds to wait} else goto @IDLE
EXPT "."r else goto @DISCONNECT
MTCH "${OK Response}" else #+2
DONE OKAY "[Custom] Response was \"${_LINE:50}\"."
MTCH "${WARN Response}" else #+2
DONE WARN "[Custom] Response was \"${_LINE:50}\"."
MTCH "${ALRM Response}" else #+2
DONE ALRM "[Custom] Response was \"${_LINE:50}\"."
MTCH "${DOWN Response}" else #+2
DONE DOWN "[Custom] Response was \"${_LINE:50}\"."
@IDLE:
DONE DOWN "[Custom] Did not receive a line of data within ${Seconds to wait} seconds. [Line ${_IDLELINE}]"
@DISCONNECT:
DONE DOWN "[Custom] Connection disconnected before a full line was received."